<?php
class PartnerController extends AppController {
    var $helpers = array ('Html','Form','Session');
    var $name = 'Partner'; // riferimento alla cartella delle view
    //var $modelClass = 'Multa';
    
    public function beforeFilter(){
    	
		parent::beforeFilter();
    	$this->loadModel('Partner');
		$this->Auth->allow('index');
		
    }

    public function index() {
    	$this->set("partners",$this->Partner->find("all"));
    }

	public function save() {
        $this->Partner->set($this->request->data);
        if($this->Partner->save()){
            $this->Session->setFlash("Bookmaker aggiornato con successo");
            $this->redirect("/Partner/edit/".$this->Partner->id);
        } else {
            $this->redirect($this->referer());
        }
	}

	public function add() {
	   $this->layout="admin";
	   $this->set("breadcrumb",__("Aggiungi Partner"));
	}
	
    public function edit($id){
	   $this->layout="admin";
       $bm = $this->Partner->read(null,$id);
       $this->set("partner",$bm); 
	   $this->set("breadcrumb",__("Modifica Partner"));
        
    }
	
	public function delete($id) {
        $this->Partner->delete($id);
        $this->Session->setFlash("Partner eliminato con successo");
		$this->redirect("/Partner");
	}
	
}
?>